/*
 * Board.h
 *
 * Board Class Holds main logic for chess game. Contains methods to find and make moves
 * Cointains 2D square array which represents actual board
 */

#ifndef BOARD_H_
#define BOARD_H_

#include "Square.h"
#include "MoveChecker.h"
#include "MoveHistory.h"
#include "StateChecker.h"
#include "Bishop.h"
#include "King.h"
#include "Knight.h"
#include "Pawn.h"
#include "Queen.h"
#include "Rook.h"



class Board{
private:

	Square board[BOARDSIZE][BOARDSIZE];		//Represents actual board
	vector<Piece*> whitePieces,blackPieces;	//Vectors that hold actual copies of each piece
	Color turn;								//Value of who's turn it is
	MoveChecker moveChecker;				//Supporting class to find valid moves
	StateChecker stateChecker;				//Supporting class to find board state
	MoveHistory history;					//Supporting class that holds move history

public:
	Board();									//Constructor
	~Board();									//Deconstructor
	Piece* getPiece(Position src);				//Returns Piece pointer for given position
	void movePiece(Position src, Position dst);	//Moves a piece from position src to position dst, updates turn and history
	bool undo();								//Undo most resent turn
	vector<Position> getMoves(Position src);	//Returns vector of valid moves of a given position
	BoardCondition getCondition(Color player);	//Returns Condition for a given Player
	Color currentTurn();						//Returns who's turn it is
	void reset();								//Resets the game
	MoveHistory	getMoveHistory();				//Returns a copy of the MoveHistory
	void loadHistory(MoveHistory &reverse);		//Takes a MoveHistory(stored in reverse order) and executes each move
												//Used for loading a game;
};


#endif /* BOARD_H_ */
